home *** CD-ROM | disk | FTP | other *** search
/ No Fragments Archive 12: Textmags & Docs / nf_archive_12.iso / MAGS / SOURCES / ATARI_SRC.ZIP / atari source / AHDI / TTFHDX / BLKTST.S < prev    next >
Encoding:
Text File  |  2001-02-09  |  950 b   |  36 lines

  1. *************************************************
  2. *                        *
  3. * int blktst(ptr,val,count);            *
  4. * long *ptr, val;                *
  5. * long count;                    *
  6. *                        *
  7. * 'count' is the number of BYTES in the buffer.    *
  8. * Returns TRUE if each longword in the block    *
  9. * equals 'val' or FALSE if there are any other    *
  10. * values there.                    *
  11. * non-0 : match;    0: don't match;        *
  12. *                        *
  13. *************************************************
  14.  
  15. _blktst::
  16.     move.l    4(sp),a0    ; a0 := start of buffer
  17.     move.l    8(sp),d0    ; d0 := value to compare against
  18.     move.l    $c(sp),d1    ; d1 := number of bytes
  19.     lsr.l    #2,d1        ; d1 := number of longs
  20.     swap    d1
  21.     move.w    d1,d2        ; d2 := hi word of d1
  22.     swap    d1
  23.  
  24.     cmp.w    d0,d0        ; make sure EQ before starting the loop.
  25.     bra.s    .end
  26.  
  27.  
  28. .loop:    cmp.l    (a0)+,d0
  29. .end:    dbne    d1,.loop
  30.     dbne    d2,.loop
  31.  
  32.     seq.b    d0        ; ccr is still 'eq' if last long == val,
  33.     and.w    #$1,d0        ; so this sets d0 as advertised.
  34.     rts            ; (boy, talk about short & sweet!)
  35.  
  36.